import java.util.HashMap;

public class Compute {
    public static void main(String[] args) {
        HashMap<Integer, Integer> hashMap = new HashMap<>();
        hashMap.put(1, 10);
        hashMap.compute(1, (key, value) -> {
            if (value == null) {
                value = 0;
            }
            return key + value;
        });
        System.out.println(hashMap);
    }
}
